#!/bin/bash

# Locust Master节点启动脚本
# 运行在 21.124.219.93 服务器上

echo "启动Locust Master节点..."
echo "服务器IP: 21.124.219.93"
echo "目标服务器1: 21.28.125.24"
echo "目标服务器2: 21.124.219.93"
echo "Web UI访问地址: http://21.124.219.93:8089"
echo "================================"

# 检查locust是否安装
if ! command -v locust &> /dev/null; then
    echo "错误: Locust未安装，请先安装: pip install locust"
    exit 1
fi

# 检查locustfile.py是否存在
if [ ! -f "locustfile.py" ]; then
    echo "错误: locustfile.py文件不存在"
    exit 1
fi

# 启动Master节点
locust -f locustfile.py --master --master-bind-host=0.0.0.0 --master-bind-port=5557 --web-host=0.0.0.0 --web-port=8089

echo "Master节点已启动"
echo "请在其他节点上运行worker脚本连接到此master"